import {hrAjax as proFetch} from 'src/hrpub/common/utils/utils';

export default function viewCard() {
	const { orgVal } = this.state;
	const clickRow = this.props.table.getClickRowIndex('ncc60071702list');
	const params = {
		pk_org: orgVal.refpk,
		allPsnPk: this.props.table
			.getAllTableData('ncc60071702list')
			.rows.map((item) => item.values.pk_psndoc.value)
			.join('_'),
		selRow: clickRow.index
	};
	proFetch({
		url: '/nccloud/hrhi/psndoc/PsndocCardReptQueryAction.do',
		body: params
	}).then((res) => {
		if (res.success && res.data) {
			let location = window.location;
			location.port
				? window.open('uclient://start/http://' + location.hostname + ':' + location.port + res.data)
				: window.open('uclient://start/http://' + location.hostname + res.data);
		}
	});
}
